@extends('admin.master')

@section('title','管理员列表')

@section('css')
    <!--dynamic table-->
    <link href="{{asset('admin/assets/js/advanced-datatable/css/demo_page.css')}}" rel="stylesheet" />
    <link href="{{asset('admin/assets/js/advanced-datatable/css/demo_table.css" rel="stylesheet')}}" />
    <link rel="stylesheet" href="{{asset('admin/assets/js/data-tables/DT_bootstrap.css')}}" />
@endsection

@section('content')
    <!-- page heading start-->
    <div class="page-heading">
        <ul class="breadcrumb">
            <li>
                <a href="{{ url('back/index') }}">后台首页</a>
            </li>
            <li>管理员</li>
            <li class="active">管理员列表</li>
        </ul>
    </div>
    <!-- page heading end-->

    <!--body wrapper start-->
    <div class="wrapper">
        @if( session()->get('msg'))
        <div class="alert alert-success alert-dismissable">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <strong>恭喜你</strong>{{  session()->get('msg') }}
        </div>
        @endif
        @if(count($errors)>0 || session()->get('error'))
            <div class="alert alert-danger alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <strong>错误</strong>
                @if(session()->get('error'))
                    {{ session()->get('error') }}
                @endif
                @if(count($errors)>0)
                    @foreach ($errors->all() as $error)
                        {{ $error }}
                    @endforeach
                @endif
            </div>
        @endif
        <div class="row">
            <div class="col-sm-12">
                <section class="panel">
                    <header class="panel-heading">
                        {{--{!! count($total) !!}条记录/每页{!! count($data) !!}条--}}
                    <span class="tools pull-right">
                        <a href="javascript:;" class="fa fa-chevron-down"></a>
                        <a href="javascript:;" class="fa fa-times"></a>
                    </span>
                        {!! Form::open(['url' => 'back/admin/table','method' => 'get']) !!}
                        <span class="tools pull-left"><input type="text" class="search input-group-lg" placeholder="Search" name="keywords" value="{{$request['keywords'] or ''}}"/><button type="submit" class="search input-group-lg">搜索</button></span>
                        {!! Form::close() !!}
                    </header>
                    <div class="panel-body">
                    <div class="adv-table">
                        <div class="adv-table">
                            <div class="table-responsive">
                            <table  class="table table-striped">
                                <tr>
                                    {!! Form::open(['url' => 'back/admin/table','method' => 'post']) !!}
                                    {{ csrf_field() }}
                                    <td class="text-center">{!! Form::button('<i class="fa fa-times"></i>'.'添加用户'.'<i class="fa fa-times"></i>',['class' => 'form-control']) !!}</td>
                                    <td class="text-center">{!! Form::text('name','',['placeholder'=> ' 用  户  名','class' => 'form-control']) !!}</td>
                                    <td class="text-center">{!! Form::text('email','',['placeholder' => ' 邮  箱 ','class' => 'form-control']) !!}</td>
                                    <td class="text-center">{!! Form::password('password',['placeholder'=> '请 输 入 密 码','class' => 'form-control']) !!}</td>
                                    <td class="text-center"> {!! Form::password('confirm',['placeholder'=> '再次输入密码','class' => 'form-control']) !!}</td>
                                    <td class="text-center">{!! Form::button('确认',['class' => 'btn btn-lg btn-login btn-block','type' => 'submit']) !!}</td>
                                    <td class="text-center">{!! Form::button('<i class="fa fa-times"></i>',['class' => 'btn btn-lg btn-login btn-block','type' => 'reset']) !!}</td>
                                    {!! Form::close() !!}
                                </tr>
                            </table>
                                </div>
                        </div>
                        <div class="table-responsive">
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr><th class="text-center">{!! Form::button('<i class="fa"></i>管理员编号',['class' => 'btn btn-lg btn-login btn-block']) !!}</th>
                                <th class="text-center">{!! Form::button('<i class="fa"></i>用户名',['class' => 'btn btn-lg btn-login btn-block']) !!}</th>
                                <th class="text-center">{!! Form::button('<i class="fa"></i>邮箱',['class' => 'btn btn-lg btn-login btn-block']) !!}</th>
                                <th class="text-center">{!! Form::button('<i class="fa"></i>状态',['class' => 'btn btn-lg btn-login btn-block']) !!}</th>
                                <th class="text-center">{!! Form::button('<i class="fa"></i>确认',['class' => 'btn btn-lg btn-login btn-block']) !!}</th>
                                <th class="text-center">{!! Form::button('<i class="fa"></i>重置',['class' => 'btn btn-lg btn-login btn-block']) !!}</th>
                                <th class="text-center">{!! Form::button('<i class="fa"></i>上次登录时间',['class' => 'btn btn-lg btn-login btn-block']) !!}</th>
                                <th class="text-center">{!! Form::button('<i class="fa"></i>注册时间',['class' => 'btn btn-lg btn-login btn-block']) !!}</th>
                                <th class="text-center">{!! Form::button('<i class="fa"></i>删除',['class' => 'btn btn-lg btn-login btn-block']) !!}</th>
                            </tr></thead>
                            <tbody>
                            @foreach($data as $key1 => $value1)
                                <tr>
                                    {!! Form::open(['url' => 'back/admin/edit','method' => 'put']) !!}
                                    {{ csrf_field() }}
                                    <td class="text-center">{!! Form::text('id',$value1->id,['class' => 'form-control']) !!}</td>
                                    <td class="text-center">{!! Form::text('name',$value1->name,['class' => 'form-control']) !!}</td>
                                    <td class="text-center">{!! Form::text('email',$value1['attributes']['email'],['class' => 'form-control']) !!}</td>
                                    <td class="text-center">{!! Form::text('status',$value1['attributes']['status'],['class' => 'form-control']) !!}</td>
                                    <td class="text-center"><a href="javascript:;">{!! Form::button('<i class="fa fa-pencil"></i>',['class' => 'btn btn-lg btn-login btn-block','type' => 'submit']) !!}</a></td>
                                    <td class="text-center"><a href="javascript:;">{!! Form::button('<i class="fa fa-refresh"></i>',['class' => 'btn btn-lg btn-login btn-block','type' => 'reset']) !!}</a></td>
                                    <td class="text-center">{!! Form::button('<i class="fa"></i>'.$value1['attributes']['updated_at'],['class' => 'btn btn-lg btn-login btn-block']) !!}</td>
                                    <td class="text-center">{!! Form::button('<i class="fa"></i>'.$value1['attributes']['created_at'],['class' => 'btn btn-lg btn-login btn-block']) !!}</td>
                                    <td class="text-center">
                                        <a href="delete/{{ $value1->id }}">
                                            {!! Form::button('<i class="fa fa-times"></i>',['class' => 'btn btn-lg btn-login btn-block']) !!}
                                        </a>
                                    </td>
                                    {!! Form::close() !!}
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                        </div>
                    </div>
                    <div class="row-fluid">

                        <div class="dataTables_paginate paging_bootstrap pagination">{!! $data->appends($request)->render() !!}</div>
                    </div>
                    </div>
                </section>
            </div>
        </div>
    </div>
<!--body wrapper end-->

<!--footer section start-->
<footer>
    2014 &copy; AdminEx by <a href="http://www.bookfrank.cn/" target="_blank">源码之家</a>
</footer>
<!--footer section end-->
@endsection

@section('js')
<!--dynamic table-->
<script type="text/javascript" language="javascript" src="{{ asset('admin/assets/js/advanced-datatable/js/jquery.dataTables.js') }}"></script>
<script type="text/javascript" src="{{ asset('admin/assets/js/data-tables/DT_bootstrap.js') }}"></script>
<!--dynamic table initialization -->
<script src="{{ asset('admin/assets/js/dynamic_table_init.js') }}"></script>
@endsection